package com.distance;

import java.io.File;
import java.util.ArrayList;


import com.bookmarks.BookmarksAdapter;
import com.google.android.maps.GeoPoint;
import com.route.DetailedLocation;

public class Bookmarks {
	public static ArrayList<DetailedLocation> locationList = new ArrayList<DetailedLocation>();;
	public static ArrayList<String> locationStrings = new ArrayList<String>();
	public static boolean run = true;
	public static int detailedLocationPositionToEdit;
	
	public static void init(){
		try{
			File f;
			f=new File("Bookmarks.txt");
			if(!f.exists()){
				f.createNewFile();
				//System.out.println("New file \"myfile.txt\" has been created to the current directory");
			}
		}
		catch(Exception e){
			
		}
	}
	
	public static void getBookmarks(){
	    if(run){
		try{
		    locationList = BookmarksAdapter.retriveBookmarkList();
		    for(DetailedLocation dl:locationList){
			locationStrings.add(dl.getLocationName());
		    }
		}catch(Exception e){
		    locationList = new ArrayList<DetailedLocation>();
		}
		run = false;
	    }
	}
	
	public static void addBookmark(){
		
	}
	
	public static void generateBookmarks(){
		//ArrayList<DetailedLocation> tempList =  new ArrayList<DetailedLocation>();
		//locationList = 
		if(locationList.size()==0){
		locationList.add(new DetailedLocation("Nanyang Polytechnic, Singapore, Singapore",new GeoPoint((int)(1.3798202*1E6), (int)(103.8489945*1E6)),"This is where I spent 3 years of my life"));
		locationList.add(new DetailedLocation("Singapore Zoo, Singapore",new GeoPoint((int)(1.4044170*1E6), (int)(103.7911390*1E6)),"I want to go here."));
		locationList.add(new DetailedLocation("585 Ang Mo Kio Avenue 3, Singapore",new GeoPoint((int)(1.3706068*1E6), (int)(103.8523412*1E6)),"Home Sweet Home"));
		for(DetailedLocation dl:locationList){
			locationStrings.add(dl.getLocationName());
		}
		}
	}

}
